"use strict";

$("#box2").click(function () {
  $("#box1").css({
    "color": "#666"
  });
  $("#account-log").css("display", "block");
  $("#log-scan").css("display", "none");
  $(this).css({
    "color": "#E4393C"
  });
});
$("#box1").click(function () {
  $("#box2").css({
    "color": "#666"
  });
  $("#account-log").css("display", "none");
  $("#log-scan").css("display", "block");
  $(this).css({
    "color": "#E4393C"
  });
});
$("#log-code").mouseover(function () {
  $("#code-img").stop().animate({
    "left": "20px"
  }, 500);
  $("#sas").css({
    "display": "block"
  });
});
$("#log-code").mouseout(function () {
  $("#code-img").stop().animate({
    "left": "75px"
  }, 500);
  $("#sas").css({
    "display": "none"
  });
});
var loguser = document.getElementById("log-user");
var logpas = document.getElementById("log-paw");
var btn1 = document.querySelector("#lodin");

btn1.onclick = function () {
  var logus = loguser.value;
  var logps = logpas.value;
  var logAPI = "http://jx.xuzhixiang.top/ap/api/login.php";
  axios.get(logAPI, {
    params: {
      username: logus,
      password: logps
    }
  }).then(function (res) {
    //请求成功
    console.log(res.data);
    localStorage.setItem('uid', res.data.data.id);
    localStorage.setItem('token', res.data.data.token);

    if (res.data.code == 1) {
      location.href = "index.html";
    }

    if (res.data.code == 0) {
      var arr1 = document.getElementById("arror");
      arr1.style.display = "block";
    }
  })["catch"](function (err) {//请求失败
  });
};